package com.zpb.framework.service.impl;

import com.zpb.framework.utils.SecurityUtils;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * @Description:
 * @Author: zhaopengbo
 * @Date: 2025/9/21
 */
@Service("ps")
public class PermissionService {
    public boolean hasAuthority(String permission){
        if (SecurityUtils.isAdmin()) {
            return true;
        }
        List<String> permissions = SecurityUtils.getUserInfo().getPermissions();
        if (permissions.contains(permission)) {
            return true;
        }
        return false;
    }
}
